﻿using System.Windows;

namespace ExampleApp3
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        private WinHooksNET.MouseGesturesModule _gesturesModule = 
            new WinHooksNET.MouseGesturesModule();

        public MainWindow()
        {
            InitializeComponent();

            //Init check points array (int format) ("U" word)
            int [,] g1CheckPoints = new int[5,5]
            {
                {1,0,0,0,13},
                {2,0,0,0,12},
                {3,0,0,0,11},
                {4,0,0,0,10},
                {5,6,7,8, 9}
            };

            //Init check points array (bool format, they are converted to 1)
            bool [,] g2CheckPoints = new bool[4,4]
            {
                {true, true,  true,  true},
                {true, false, false, true},
                {true, false, false, true},
                {true, true,  true,  true}
            };

            //Register gestures
            _gesturesModule.RegisterGesture("First Gesture", g1CheckPoints);
            _gesturesModule.RegisterGesture("Second Gesture", g2CheckPoints);

            //Set gestures tolerance
            _gesturesModule.GestureTolerance = 2;

            _gesturesModule.MouseGestureChecked += _gesturesModule_MouseGestureChecked;
        }

        void _gesturesModule_MouseGestureChecked(object sender, WinHooksNET.Events.MouseGestureEventArgs e)
        {
            LB_Gestures.Items.Add("Name: " + e.Name);
        }
    }
}
